package cn.JHai.dao;
import cn.JHai.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

public interface UsersDao {

	@Insert("insert into user (name,password,email,headimg) values (#{name},#{password},#{email},#{headimg})")
	public boolean insert(User user) ;

	@Select("select * from user")
	public ArrayList<User> findAll();

	@Select("select * from user where id=#{uid}")
	public User find(int uid) ;

	@Select("select * from user where name = #{name} and password = #{password}")
	public User findUser(String name,String password);

	@Delete("delete from user where uid=#{id} ")
	public boolean delete(int id) ;

	@Update("update user set name=#{name},password=#{password},email=#{email},headimg=#{headimg} where mid=#{mid}")
	public boolean update(User user) ;
	}
